package com.sh.shanhuo.database.web;

import java.util.List;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

@Dao
public interface WebInfoDao {

    @Query("SELECT * FROM web_info WHERE deleteFlag=0")
    List<WebInfoEntity> queryAll();

    @Query("SELECT * FROM web_info WHERE webId LIKE :webId")
    WebInfoEntity findByWebId(String webId);

    @Query("SELECT * FROM web_info WHERE webName LIKE :webName")
    WebInfoEntity findByWebName(String webName);

    @Query("SELECT * FROM web_info WHERE sortName LIKE :sortName AND deleteFlag=0")
    List<WebInfoEntity> findBySortId(String sortName);


    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(WebInfoEntity webInfoEntity);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<WebInfoEntity> webInfoEntities);

    @Update()
    int update(WebInfoEntity webInfoEntity);

    @Update()
    int updateAll(WebInfoEntity... webInfoEntities);

    @Update()
    int updateAll(List<WebInfoEntity> webInfoEntities);

    @Delete
    int delete(WebInfoEntity webInfoEntity);

    @Delete
    int deleteAll(WebInfoEntity... webInfoEntities);

    @Delete
    int deleteAll(List<WebInfoEntity> webInfoEntities);


}
